package j2src;

import java.util.Vector;
import beans.RecruitBoardDaoHome;
import beans.RecruitBoardDaoRemote;
import beans.RecruitBoardDto;


public class RecruitBoardDaoDelegate {
	private RecruitBoardDaoHome recruitBoardDaoHome;
    private RecruitBoardDaoRemote recruitBoardDaoRemote;
    public RecruitBoardDaoDelegate() throws Exception {
    	initializeRecruitBoardDaoHome();
        recruitBoardDaoRemote = recruitBoardDaoHome.create();
    }
    public Vector getAllRecruitBoard() throws Exception{
    	return recruitBoardDaoRemote.getAllRecruitBoard();
    }
	public RecruitBoardDto getOneRecruitBoard(String recruitId) throws Exception{
		return recruitBoardDaoRemote.getOneRecruitBoard(recruitId);
	}
	public boolean insertRecruitBoard(RecruitBoardDto rbDto) throws Exception{
		return recruitBoardDaoRemote.insertRecruitBoard(rbDto);
	}
	public boolean updateRecruitBoard(RecruitBoardDto rbDto) throws Exception{
		return recruitBoardDaoRemote.updateRecruitBoard(rbDto);
	}
	public boolean deleteRecruitBoard(RecruitBoardDto rbDto) throws Exception{
		return recruitBoardDaoRemote.deleteRecruitBoard(rbDto);
	}
    
    private void initializeRecruitBoardDaoHome() throws Exception {
        String FACADE_NAME = "RecruitBoardDaoBean";
        Class FACADE_CLASS = beans.RecruitBoardDaoHome.class;
        if (recruitBoardDaoHome == null) {
            try {
                WhiteDaoLocator locator = WhiteDaoLocator.getInstance();
                recruitBoardDaoHome = (RecruitBoardDaoHome) WhiteDaoLocator.getEjbHome(FACADE_NAME, FACADE_CLASS);
                if (recruitBoardDaoHome == null) {
                    throw new Exception("Did not get home for " + FACADE_NAME);
                }
            } catch (WhiteDaoLocatorException e) {
                throw new Exception(e.getMessage());
            }
        }
    }
}
